#ifndef __MPP_DISPLAY_PLANES_H__
#define __MPP_DISPLAY_PLANES_H__

#include "mpp_display_element.h"
#include "mpp_display_buffer.h"
using namespace  std;


class mpp_display_planes:protected mpp_display_element
{
    public:
        mpp_display_planes();
        ~mpp_display_planes();
    protected:
        int  mpp_planes_create(int fd,uint32_t count_crtc) ;
        void  mpp_planes_distroy();
        void mpp_planes_put_plane(drmModePlanePtr plane);



        class  PLANE_INFO
        {
            public:
            drmModePlanePtr     planes;
            mpp_display_buffer *buffer;
            bool                            is_use;
            uint32_t                     format;

            /* Property ID's */
            uint32_t crtc_pid;
            uint32_t fb_pid;
            uint32_t zpos_pid;
            uint32_t crtc_x_pid;
            uint32_t crtc_y_pid;
            uint32_t crtc_w_pid;
            uint32_t crtc_h_pid;
            uint32_t src_x_pid;
            uint32_t src_y_pid;
            uint32_t src_w_pid;
            uint32_t src_h_pid;
            PLANE_INFO():planes(NULL),
                                buffer(NULL),
                                is_use(0),
                                format(0),

                                /* Property ID's */
                                crtc_pid(0),
                                fb_pid(0),
                                zpos_pid(0),
                                crtc_x_pid(0),
                                crtc_y_pid(0),
                                crtc_w_pid(0),
                                crtc_h_pid(0),
                                src_x_pid(0),
                                src_y_pid(0),
                                src_w_pid(0),
                                src_h_pid(0)
            {

            }
            PLANE_INFO & operator =(const PLANE_INFO & str) 
            {
                if (this != &str){
                    this->planes=str.planes;
                    this->buffer=str.buffer;
                    this->is_use=str.is_use;
                    this->format=str.format;

                    /* Property ID's */
                    this->crtc_pid=str.crtc_pid;
                    this->fb_pid=str.fb_pid;
                    this->zpos_pid=str.zpos_pid;
                    this->crtc_x_pid=str.crtc_x_pid;
                    this->crtc_y_pid=str.crtc_y_pid;
                    this->crtc_w_pid=str.crtc_w_pid;
                    this->crtc_h_pid=str.crtc_h_pid;
                    this->src_x_pid=str.src_x_pid;
                    this->src_y_pid=str.src_y_pid;
                    this->src_w_pid=str.src_w_pid;
                    this-> src_h_pid=str.src_h_pid;
                }
                return *this;
            }
        };

        drmModePlanePtr mpp_get_planes(uint32_t format);
        

    private:
        int mpp_display_init_screens();
       
        
        
        uint32_t possible_planes;
        
        // uint32_t count_planes;
        // drmModePlanePtr *planes;
        // uint32_t  width ;
        // uint32_t height;
        // uint32_t format;
        
        
        vector<PLANE_INFO> planes;

};


#endif